package cn.dengta.webapp.trade.vo;

import javax.annotation.Nullable;

import cn.dengta.common.validator.FormHelper;
import cn.dengta.webapp.base.vo.AbstractVO;
import cn.dengta.webapp.trade.entity.Gift;
import com.alibaba.fastjson2.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

@Setter
@Getter
@Accessors(chain = true)
public class UserGiftVO extends AbstractVO<Gift> {

	public GiftVO gift;
	public Integer num;
	public Integer amount;
	/** 礼物特效是否播放：只有为 false 时才不会播放 */
	public Boolean play;
	public String toNickname;
	/** 0=默认场景；1=视频场景 */
	public Integer eventType;
	/** tips 消息 */
	public Boolean hasTip;
	/** 积分数据 */
	public JSONObject integral;

	/** 亲密度升级奖励 */
	JSONObject upgradeAward;

	public static UserGiftVO from(@Nullable Gift source, Integer num, Integer amount, Integer eventType) {
		UserGiftVO vo = new UserGiftVO();
		vo.gift = GiftVO.fromMsgPush(source);
		vo.amount = amount;
		vo.eventType = FormHelper.nullAsZero(eventType);
		vo.num = num;
		return vo;
	}

	public static UserGiftVO fromGroup(@Nullable Gift source, Integer num, Integer amount, boolean play, String toNickname) {
		UserGiftVO vo = new UserGiftVO();
		vo.gift = GiftVO.fromMsgPush(source);
		vo.amount = amount;
		vo.num = num;
		vo.play = play;
		vo.toNickname = toNickname;
		return vo;
	}

}
